home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1997 February / EnigmA AMIGA RUN 15 (1997)(G.R. Edizioni)(IT)[!][issue 1997-02][PLANET CD V].iso / enigma / earcd / emula / arosdv19.lha / AROS / intuition / newmodifyprop.c < prev    next >
C/C++ Source or Header  |  1996-11-08  |  4KB  |  137 lines

  1. /*
  2.     (C) 1995-96 AROS - The Amiga Replacement OS
  3.     $Id: newmodifyprop.c,v 1.3 1996/11/08 11:28:04 aros Exp $
  4.     $Log: newmodifyprop.c,v $
  5.     Revision 1.3  1996/11/08 11:28:04  aros
  6.     All OS function use now Amiga types
  7.  
  8.     Moved intuition-driver protos to intuition_intern.h
  9.  
  10.     Revision 1.2  1996/10/24 15:51:22  aros
  11.     Use the official AROS macros over the __AROS versions.
  12.  
  13.     Revision 1.1  1996/10/10 13:09:55  digulla
  14.     New function: NewModifyProp()
  15.  
  16.  
  17.     Desc:
  18.     Lang: english
  19. */
  20. #include "intuition_intern.h"
  21. #include "propgadgets.h"
  22.  
  23. /*****************************************************************************
  24.  
  25.     NAME */
  26.     #include <intuition/intuition.h>
  27.     #include <clib/intuition_protos.h>
  28.  
  29.     AROS_LH9(void, NewModifyProp,
  30.  
  31. /*  SYNOPSIS */
  32.     AROS_LHA(struct Gadget    *, gadget, A0),
  33.     AROS_LHA(struct Window    *, window, A1),
  34.     AROS_LHA(struct Requester *, requester, A2),
  35.     AROS_LHA(ULONG             , flags, D0),
  36.     AROS_LHA(ULONG             , horizPot, D1),
  37.     AROS_LHA(ULONG             , vertPot, D2),
  38.     AROS_LHA(ULONG             , horizBody, D3),
  39.     AROS_LHA(ULONG             , vertBody, D4),
  40.     AROS_LHA(LONG              , numGad, D5),
  41.  
  42. /*  LOCATION */
  43.     struct IntuitionBase *, IntuitionBase, 78, Intuition)
  44.  
  45. /*  FUNCTION
  46.     Changes the values in the PropInfo-structure of a proportional
  47.     gadget and refreshes the specified number of gadgets beginning
  48.     at the proportional gadget. If numGad is 0 (zero), then no
  49.     refreshing is done.
  50.  
  51.     INPUTS
  52.     gadget - Must be a PROPGADGET
  53.     window - The window which contains the gadget
  54.     requester - If the gadget has GTYP_REQGADGET set, this must be
  55.         non-NULL.
  56.     flags - New flags
  57.     horizPot - New value for the HorizPot field of the PropInfo
  58.     vertPot - New value for the VertPot field of the PropInfo
  59.     horizBody - New value for the HorizBody field of the PropInfo
  60.     vertBody - New value for the VertBody field of the PropInfo
  61.     numGad - How many gadgets to refresh. 0 means none (not even
  62.         the current gadget) and -1 means all of them.
  63.  
  64.     RESULT
  65.     None.
  66.  
  67.     NOTES
  68.  
  69.     EXAMPLE
  70.  
  71.     BUGS
  72.  
  73.     SEE ALSO
  74.     NewModifyProp(), RefreshGadgets(), RefreshGList()
  75.  
  76.     INTERNALS
  77.  
  78.     HISTORY
  79.     29-10-95    digulla automatically created from
  80.                 intuition_lib.fd and clib/intuition_protos.h
  81.  
  82. *****************************************************************************/
  83. {
  84.     AROS_LIBFUNC_INIT
  85.     AROS_LIBBASE_EXT_DECL(struct IntuitionBase *,IntuitionBase)
  86.     struct PropInfo * pi;
  87.     struct BBox old, new;
  88.     int right, bottom;
  89.  
  90.     if ((gadget->GadgetType & GTYP_GTYPEMASK) != GTYP_PROPGADGET
  91.     || !gadget->SpecialInfo
  92.     )
  93.     return;
  94.  
  95.     pi = gadget->SpecialInfo;
  96.  
  97.     CalcBBox (window, gadget, &old);
  98.  
  99.     new = old;
  100.  
  101.     CalcKnobSize (gadget, &old);
  102.  
  103.     pi->Flags = flags;
  104.     pi->HorizPot = horizPot;
  105.     pi->VertPot = vertPot;
  106.     pi->HorizBody = horizBody;
  107.     pi->VertBody = vertBody;
  108.  
  109.     CalcKnobSize (gadget, &new);
  110.  
  111.     right = old.Left + old.Width; /* No -1 here; we don't add +1 later */
  112.     bottom = old.Top + old.Height;
  113.  
  114.     /* Calculate area to clear */
  115.     if (new.Left < old.Left)
  116.     old.Left = new.Left;
  117.  
  118.     if (new.Top < old.Top)
  119.     old.Top = new.Top;
  120.  
  121.     if (new.Left+new.Width > right)
  122.     right = new.Left + new.Width;
  123.  
  124.     if (new.Top+new.Height > bottom)
  125.     bottom = new.Top + new.Height;
  126.  
  127.     old.Width = right - old.Left; /* No +1 here; see above */
  128.     old.Height = bottom - old.Top; /* No +1 here; see above */
  129.  
  130.     RefreshPropGadgetKnob (flags, &old, &new, window, IntuitionBase);
  131.  
  132.     if (numGad > 1 && gadget->NextGadget)
  133.     RefreshGList (gadget->NextGadget, window, requester, numGad-1);
  134.  
  135.     AROS_LIBFUNC_EXIT
  136. } /* NewModifyProp */
  137.